package com.easy.easylibdemo.ui.copypopup;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.TextView;

import com.easy.easylibdemo.R;
import com.easylib.base.BaseActivity;
import com.easylib.utils.ToastUtils;
import com.easylib.views.CopyPopupWindow;

import butterknife.Bind;
import butterknife.OnLongClick;

public class CopyPopupActivity extends BaseActivity {


    @Bind(R.id.tv)
    TextView tv;
    @Bind(R.id.btn)
    Button btn;
    @Bind(R.id.cb)
    CheckBox cb;
    @Bind(R.id.rb)
    RadioButton rb;
    @Bind(R.id.et)
    EditText et;

    @Override
    public int getContentViewId() {
        return R.layout.activity_copy_popup;
    }

    @Override
    protected void initView(Bundle savedInstanceState) {

    }

    @Override
    protected void initVariable() {

    }

    @Override
    protected void processLogic(Bundle savedInstanceState) {

    }

    @OnLongClick({R.id.tv, R.id.btn, R.id.cb, R.id.rb, R.id.et})
    public boolean onViewClicked(TextView view) {
        switch (view.getId()) {
            case R.id.tv:
                showPopup(view);
                break;
            case R.id.btn:
                showPopup(view);
                break;
            case R.id.cb:
                showPopup(view);
                break;
            case R.id.rb:
                showPopup(view);
                break;
            case R.id.et:
                showPopup(view);
                break;
        }
        return true;
    }

    private void showPopup(TextView view){
        CopyPopupWindow.getInstance().init(mActivity).showPopupWindow(view).setPopOnclickListener(new CopyPopupWindow.PopOnclickListener() {
            @Override
            public void onClick(View v, String text) {
                ToastUtils.showToast(text);
            }
        });
    }
}
